package com.ssi.dao.shop.impl;

import java.util.List;

import com.ssi.common.CommonDao;
import com.ssi.dao.shop.ShopDao;
import com.ssi.domain.goods.Goods;
import com.ssi.domain.shop.Shop;
/**
 * 
 * @author  lxf
 *
 */
public class ShopDaoImpl extends CommonDao implements ShopDao {
	private final String addShop = "shop.addShop";
	private final String updateShop = "shop.updateShop";
	private final String deleteShop = "shop.deleteShop";
	private final String queryShopById = "shop.queryShopById";
	private final String queryAllShop = "shop.queryAllShop";
	private final String queryAllShopByName = "shop.queryAllShopByName";
	private final String queryShopByUserId = "shop.queryShopByUserId";
	private final String queryShopTop10 = "shop.queryShopTop10";

	public void addShop(Shop shop) {
		sqlSessionTemplate.insert(addShop, shop);
	}


	public void updateShop(Shop shop) {
		sqlSessionTemplate.update(updateShop, shop);
	}

	public void deleteShop(int shopId) {
		sqlSessionTemplate.delete(deleteShop, shopId);
	}


	public Shop queryShopById(int id) {
		return sqlSessionTemplate.selectOne(queryShopById, id);
	}


	public List<Shop> queryAllShop() {
		return sqlSessionTemplate.selectList(queryAllShop,"");
	}


	public List<Shop> queryAllShopByName(String name) {
		return sqlSessionTemplate.selectList(queryAllShopByName,name);
	}

	public List<Shop> queryShopByUserId(int id) {
		return sqlSessionTemplate.selectList(queryShopByUserId,id);
	}


	public List<Goods> queryShopTop10(int count) {
		return sqlSessionTemplate.selectList(queryShopTop10,count);
	}



}
